<template>
  <el-card>
    <div slot="header">
      <h3>商品多计量单位修改-表单查看</h3>
    </div>
    <el-row class="page_wrap">
      <SkusTable
        :loading="tableInfo.loading"
        :columns="tableInfo.columns"
        :dataSource="tableInfo.list"
        :tableHeight="480"
      />
    </el-row>
    <FooterFields :recordNo="recordNo" />
  </el-card>
</template>
<script>
import SkusTable from '@/components/skusTable';
import FooterFields from '@/pages/commodity/components/FooterFields';
import { TABLE_COLUMNS } from './constants/view';
import { getUnitsRecordInfoService } from '@/api/commodity/commodityManage/unitsManage';
export default {
  components: {
    SkusTable,
    FooterFields
  },
  data () {
    return {
      tableInfo: {
        list: [],
        columns: TABLE_COLUMNS,
        loading: false
      },
      recordNo: ''
    }
  },
  mounted () {
    this.recordNo = this.$route.query?.recordNo ?? '';
    if (this.recordNo) {
      this.getRecordInfo(this.recordNo);
    }
  },
  methods: {
    async getRecordInfo (recordNo) {
      const retData = await getUnitsRecordInfoService({ recordNo }, 'page_wrap');
      if (retData) {
        this.tableInfo.list = retData;
      }
    }
  }
}
</script>
